Build, test, and submit your app using Xcode, Apple's integrated development environment.

Posts under Xcode tag

200 Posts

Post

Replies

Boosts

Views

Activity

Resolving a "Simulator runtime is not available" error
Some Macs recently received a macOS system update which disabled the simulator runtimes used by Xcode 15, including the simulators for iOS, tvOS, watchOS, and visionOS. If your Mac received this update, you will receive the following error message and will be unable to use the simulator: The com.apple.CoreSimulator.SimRuntime.iOS-17-2 simulator runtime is not available. Domain: com.apple.CoreSimulator.SimError Code: 401 Failure Reason: runtime profile not found using "System" match policy Recovery Suggestion: Download the com.apple.CoreSimulator.SimRuntime.iOS-17-2 simulator runtime from the Xcode To resume using the simulator, please reboot your Mac. After rebooting, check Xcode Preferences → Platforms to ensure that the simulator runtime you would like to use is still installed. If it is missing, use the Get button to download it again. The Xcode 15.3 Release Notes are also updated with this information.
0
0
9k
May ’24
Xcode crashes when deleting a target
I have a test target in my app MacPacker (download via github.com/sarensw/MacPacker as this is open source). I want to remove the test target in Xcode. However, Xcode crashes when I try to delete it. I have submitted an issue in the Feedback app (FB20976404). I'm posting here to see if anyone else has the same issue and has a workaround. Or, maybe there is an alternative way to get rid of a target? Steps to reproduce: Open project file Select test target in TARGETS on the left side of the project file editor Click the “-“ button to remove that target Found in: Xcode 26.1 (and also before in Xcode 26.0)
3
0
41
1h
How to correctly fetch data using SwiftData
Hi there! I'm making an app that stores data for the user's profile in SwiftData. I was originally going to use UserDefaults but I thought SwiftData could save Images natively but this is not true so I really could switch back to UserDefaults and save images as Data but I'd like to try to get this to work first. So essentially I have textfields and I save the values of them through a class allProfileData. Here's the code for that: import SwiftData import SwiftUI @Model class allProfileData { var profileImageData: Data? var email: String var bio: String var username: String var profileImage: Image { if let data = profileImageData, let uiImage = UIImage(data: data) { return Image(uiImage: uiImage) } else { return Image("DefaultProfile") } } init(email:String, profileImageData: Data?, bio: String, username:String) { self.profileImageData = profileImageData self.email = email self.bio = bio self.username = username } } To save this I create a new class (I think, I'm new) and save it through ModelContext import SwiftUI import SwiftData struct CreateAccountView: View { @Query var profiledata: [allProfileData] @Environment(\.modelContext) private var modelContext let newData = allProfileData(email: "", profileImageData: nil, bio: "", username: "") var body: some View { Button("Button") { newData.email = email modelContext.insert(newData) try? modelContext.save() print(newData.email) } } } To fetch the data, I originally thought that @Query would fetch that data but I saw that it fetches it asynchronously so I attempted to manually fetch it, but they both fetched nothing import SwiftData import SwiftUI @Query var profiledata: [allProfileData] @Environment(\.modelContext) private var modelContext let fetchRequest = FetchDescriptor<allProfileData>() let fetchedData = try? modelContext.fetch(fetchRequest) print("Fetched count: \(fetchedData?.count ?? 0)") if let imageData = profiledata.first?.profileImageData, let uiImage = UIImage(data: imageData) { profileImage = Image(uiImage: uiImage) } else { profileImage = Image("DefaultProfile") } No errors. Thanks in advance
6
0
166
1h
Cannot Preview in this file. Simulator was shutdown during an update.
Hello, I am facing a recurring issue with Xcode iOS simulator (preview). I want to preview a SwiftUI for iOS in Xcode, but the Simulator app fails to boot up. I receive the following error in Xcode: Cannot Preview in this file. Simulator was shutdown during an update. I have tried the following: Completely uninstalling XCode and deleting all developer data, then reinstalling everthing again. Shutdown and restart Deleting all developer data, deleting XCode cache Reinstalling iOS Simulator runtimes and reconfiguration of simulators. Tested using different simulator and runtime versions. "xcrun simctl --set previews delete al" My reported issues: FB20987522 FB20485454 Thank you Best regards, Jens
1
0
30
3h
Xcode 26.1 ChatGPT very slow
ChatGPT in Xcode 26.1 is super slow for me. What used to complete in a batter f seconds is now taking tens of minutes. Context: M2 Pro MBP, Xcode 26.1, macOS 26.1. CPU stays under 50% while ChatGPT returns. Using the minimal setting. Tried restarting, have verified I have nothing running Electron, no other apps are running. ChatGPT returns fast for the displayed content but the preview window where it renders code per line takes a few seconds per line.
18
11
543
3h
Module dependency cycle errors in Xcode 26
I just updated to Xcode 26 and some of my Swift Packages have been getting strange build errors that I have not been able to resolve. When I try to build my Swift Package in Xcode I get the following error Module dependency cycle: 'UIKit.swiftmodule -> .swiftmodule -> SafariServices.swiftmodule -> UIKit.swiftmodule' It seems like it is related to the change in Xcode 26 that states "Swift explicit modules will be the default mode for building all Swift targets". I see that you can disable this with the build setting SWIFT_ENABLE_EXPLICIT_MODULES=NO, but I don't see a way to do this in Package.swift, as you can't include value assignments like this .define("SWIFT_ENABLE_EXPLICIT_MODULES=NO"). Our private SPM repos use CI/CD and so we need to be able to build them independently of any use in a project. I would appreciate any help on fixing our Swift Package builds in Xcode 26, thanks!
2
1
95
4h
Cannot Preview in this file. Simulator was shutdown during an update.
Hello, I am facing a recurring issue with Xcode iOS simulator (preview). I want to preview a SwiftUI for iOS in Xcode, but the Simulator app fails to boot up. I receive the follow error in Xcode: Cannot Preview in this file. Simulator was shutdown during an update. I have tried the following: Uninstall Xcode and reinstall it again Deleting all developer data Deleting Xcode cache Reinstalling iOS Simulator runtimes and reconfiguration of simulators. Tested using different simulator and runtime versions. "xcrun simctl --set previews delete al" I reported the issue: FB20485454 FB20987522 Thank you. Best regards, Jens
0
0
18
5h
Simulators (iOS 26.1) clean takes up to 15min every time
We have the following step before running any tests on CI machine: xcrun simctl shutdown all && xcrun simctl erase all It was working perfectly before Xcode 26.1. On Beta 3 it was doing it for 15 min every time. When updated to RC1, the tests with cached build are fast (clean goes up to 10 sec), but the package tests clean is still going up to 15 min every time. We did xcrun simctl runtime dyld_shared_cache update --all as advised but it's helping only temporarily. Is this going to be fixed in the official release?
2
1
143
9h
Xcode 26 failed to download any simulator (ios, watchOS, tvOS)
As subject, after update to Xcode 26.0.1, none of the simulator able to download, tried click the Get button, tried run command in terminal, all failed. Error from terminal: xcodebuild -downloadPlatform iOS Finding content... Automatically resolved architecture variant for platform iOS as 'universal'. 2025-10-09 06:21:24.423 xcodebuild[1789:30064] DVTDownloadable: Download Failed. Downloadable: { architectures = ( arm64, "x86_64" ); authentication = none; category = simulator; contentType = cryptexDiskImage; dictionaryVersion = 2; downloadMethod = mobileAsset; fileSize = 10066611438; identifier = "com.apple.dmg.iPhoneSimulatorSDK26_0"; isInternalContent = 0; isUserInitiated = 1; name = "iOS 26.0 Universal Simulator (23A343)"; patchableFrom = ( ); platform = "com.apple.platform.iphoneos"; simulatorVersion = { buildUpdate = 23A343; version = "26.0"; }; version = "26.0.0.0"; }. Download failed. Any idea how to resolve this? iMac with Intel processor
3
1
261
9h
Unable to find identity (but have private key and certificate)
I'm unable to sign the an example application using xcode and "automatically manage signing". The error I'm getting is: CodeSign [...] (in target 'foobar' from project 'foobar') Signing Identity: "Apple Development: [xxxx] " /usr/bin/codesign --force --sign 4ABB258102FF656E9F597546A49274C28D2B8B3E -o runtime --timestamp\=none --generate-entitlement-der [filename] 4ABB258102FF656E9F597546A49274C28D2B8B3E: no identity found Command CodeSign failed with a nonzero exit code However, I am able to see a certificate and a private identity on my keychain: % security find-certificate -aZ | grep -i 4ABB258102FF656E9F597546A49274C28D2B8B3E SHA-1 hash: 4ABB258102FF656E9F597546A49274C28D2B8B3E and % security find-key -s | grep -q 'Apple Development' && echo YES YES what is puzzling is that security does not find an identity: % security find-identity -p codesigning Policy: Code Signing Matching identities 0 identities found Valid identities only 0 valid identities found but XCode claims that everything is working fine. Anybody knows what might I be missing? I tried logging out, requesting new certificates, rebooting, moving them to another keychain, and asking to developer friends.
1
0
73
10h
Code Coverage Not Accurate in Xcode 26
Description: I’m noticing that the code coverage metrics in Xcode 26 are not accurate compared to earlier versions. In Xcode 15, the same set of unit tests shows around 38% coverage, but in Xcode 26, even though all the tests are running successfully (for example, the SegmentedUI test cases), the code coverage is displayed as 0%. Has anyone else observed this behavior in Xcode 26? Is there any known issue, workaround, or configuration change required to get the correct coverage report? Environment: Xcode 26 iOS 18 SDK Unit tests running under XCTest Any insights or suggestions would be appreciated.
0
0
31
13h
Changing watchOS Deployment Target - What happens to users on old versions
This is probably a silly question, but I couldn't find the answer to it in the forums or in the documentation, though I may be missing something. I currently have an app with a deployment target of iOS 16 and a watchOS app (not independent) with a deployment target of watchOS 7. I understand what happens when I change the deployment target on the iOS app (e.g., users with iOS/iPadOS versions less than 16 will just never see the updates in the App Store). But what happens if I change the deployment target of the watchOS dependent app to something like watchOS 8? Will users who have iOS 16 and watchOS 7 (iOS meets deployment target/watchOS does not) get the app update, and it'll just uninstall the watchOS app automatically? Will they just not see the update? Does the old version of the Watch app somehow stay on their watch while the iOS app gets updated?
4
0
2.4k
14h
App Not Appearing in "Available Apps" List in Watch App
I’ve developed an Apple Watch extension for an existing iOS app. When I run the app on the watch via Xcode using the simulator, everything works fine. However, when I try to install it on my iPhone, the Watch app doesn’t show it in the "Available Apps" list, so I can't install it on the watch. The Apple Watch is connected to my iPhone, and I can see other apps available for installation without any issues. I also created a brand new project with watchOS support to troubleshoot, but the same problem occurred. Any ideas on how to resolve this?
2
0
527
23h
UI Testing and 'Allow Paste'
I am developing an app that allows the user to ask it to process the clipboard contents and do something with it. In developing a XC UI Test, I find the app stops while it waits for the user to give permission. That breaks the automation. I tried: let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard") let allowButton = springboard.buttons["Allow Paste"] But that does not work. Is there a way to tell the framework to automatically give the test permission to access the Paste clipboard (or to allow me to write tests to grant this)?
0
0
12
1d
HTTP Requests Failing on iOS Simulator but Working on Physical Devices
Hello everyone, We are currently facing an issue when testing our hybrid mobile application (built with Ionic and Angular) on the iOS Simulator. The app works perfectly on physical iOS devices — all HTTP requests complete successfully. However, when running the same build on the iOS Simulator, every HTTP request fails with the following error: { "headers": { "normalizedNames": {}, "lazyUpdate": null, "headers": {} }, "status": 0, "statusText": "Unknown Error", "url": "https://api.bizify.com.br/demo/api/ping", "ok": false, "name": "HttpErrorResponse", "message": "Http failure response for https://api.bizify.com.br/demo/api/ping: 0 Unknown Error", "error": { "isTrusted": true } } We have confirmed that the API endpoint https://api.bizify.com.br/demo/api/ping is reachable and secured with a valid SSL certificate. This issue occurs only in the iOS Simulator — not on Android devices or physical iOS devices. Has anyone encountered this issue before? Any insights on why the iOS Simulator might be blocking or failing these HTTPS requests — and how we could resolve it — would be greatly appreciated.
2
0
47
1d
Validation failed (-19241) The app contains one or more corrupted binaries. Rebuild the app and resubmit.
I am using XCode (Version 26.0.1 (17A400)) -> Archive -> Distribute App (or Validate App) to upload my iOS app into App Store Connect. However I am always getting this error: Uploading SPI errors: Validation failed (409) The app contains one or more corrupted binaries. Rebuild the app and resubmit. NSUnderlyingError : Validation failed (-19241) The app contains one or more corrupted binaries. Rebuild the app and resubmit. code : STATE_ERROR.VALIDATION_ERROR I tried exporting the app as an IPA and uploading with Transporter, but I see the same error. I couldn't find any other useful logs or error messages. More info: I have created the app in App Store Connect and this is my first time uploading. The app can build and run on my physical phone and emulator without any problem. Would be great to get some help! Thanks!
1
0
115
1d
Xcode 26.x Frequently Freezes During Breakpoint Debugging with Simulator
When I use Xcode 26 (0.1, 1) for debugging and hit a breakpoint, using "step over" causes the debugger to freeze at a random line of code. Clicking "Pause program execution" indicates that the line is being executed, but the breakpoint never exits, seemingly causing a freeze. The application on the simulator also becomes unresponsive. However, when I do not use breakpoints, my program runs smoothly, and debugging on a physical device does not cause any freezes. This issue only occurs with the simulator. I am using Xcode on Apple Silicon, and due to some third-party SDKs that depend on Rosetta, our app can only run on the Rosetta simulator. We did not encounter this issue when using Xcode 16.x for simulator debugging. The current situation with Xcode 26.x significantly reduces our development efficiency. What could be causing this, and is there a solution?
2
0
137
1d
Testing/debugging QLThumbnailProvider on macOS
I'm implementing the 'new' QLThumbnailProvider for our macOS app... So I just created the skeleton from Xcode, added our QLSupportedContentTypes in Info.plist, and have the skeleton code like below: import QuickLookThumbnailing class ThumbnailProvider: QLThumbnailProvider { override func provideThumbnail(for request: QLFileThumbnailRequest, _ handler: @escaping (QLThumbnailReply?, Error?) -> Void) { // cannot trigger break point here! } I understand I should test the Thumbnail Extension by using: $ qlmanage -t my_file.ext Testing Quick Look thumbnails with files: my_file.ext But I don't know what process to attach to in the Xcode debugger... a bit clueless... I've skimmed relevant parts of https://developer.apple.com/videos/play/wwdc2019/719, but there is no real debug tips... Does anyone know if it is possible to debug with Xcode or not? And if possible, then how? 😅
3
0
150
1d